package com.boho.base.dao;


/**
 * @File name:  TSystemStatusDao.java 
 * @Create on:  2010-05-10 19:19:234
 * @Author   :  陈伟
 *
 * @ChangeList
 * ---------------------------------------------------
 * Date         Editor              ChangeReasons
 *
 */


import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import cn.boho.framework.po.CQuery;
import cn.boho.framework.po.CQueryFactoryTool;
import cn.boho.framework.po.DAO;
import cn.boho.framework.po.DynaBeanMap;

/**
 * 【数据字典表:T_SYSTEM_STATUS】的Dao操作类
 * 
 */
public class TSystemStatusDao extends DAO {
	/**
	 * 根据类别查询【数据字典表:T_SYSTEM_STATUS】信息
	 * 
	 * @param con
	 * @param status_type 状态类别
	 * @return
	 * @throws Exception
	 * @date 2009-04-22
	 * @author 陈伟
	 * 
	 */
	@SuppressWarnings("unchecked")
	public static List queryTSystemStatus(Connection con, String status_type)
			throws Exception {
		List list = new ArrayList();
		StringBuffer sql = new StringBuffer();
		sql.append("select STATUS_CODE,STATUS_NAME from T_SYSTEM_STATUS where STATUS_TYPE=?");
		CQuery query = CQueryFactoryTool.createFactory().createCQuery();
		query.setCommand(sql.toString());
		query.setString(1, status_type);
		logger.debug("TSystemStatusDao.queryTSystemStatus() SQL->"+query.getCommand());
		list = query.getDynaBeanMapList("T_SYSTEM_STATUS", con);
		return list;
	}

	/**
	 * 根据主键【状态类型:STATUS_TYPE|状态代码:STATUS_CODE|】获得信息
	 * 
	 * @param con
	 * @param statusType
	 *            状态类型
	 * @param statusCode
	 *            状态代码
	 * @return
	 * @throws Exception
	 * @author 陈伟
	 * 
	 */
	@SuppressWarnings("unchecked")
	public static DynaBeanMap getTSystemStatusByPk(Connection con,
			java.lang.String statusType, java.lang.String statusCode)
			throws Exception {
		DynaBeanMap dynaBeanMap = null;
		StringBuffer sql = new StringBuffer();
		sql.append("select STATUS_CODE,STATUS_NAME from T_SYSTEM_STATUS where  STATUS_TYPE=? and STATUS_CODE=?");
		CQuery query = CQueryFactoryTool.createFactory().createCQuery();
		query.setCommand(sql.toString());
		query.setString(1, statusType);
		query.setString(2, statusCode);
		logger.debug("TSystemStatusDao.getTSystemStatusByPk() SQL->"+query.getCommand());
		dynaBeanMap = query.getDynaBeanMap("T_SYSTEM_STATUS", con);
		return dynaBeanMap;
	}

}
